<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="author" content="phpadmin" />
    <link href="login.css" type="text/css" rel="stylesheet"/>
    <title>BOOK_CITY</title>
    <script type="text/javascript" src="/thinkphp/firstproject/Public/Js/Base.js"></script>
    <script type="text/javascript" src="/thinkphp/firstproject/Public/Js/prototype.js"></script>
    <script type="text/javascript" src="/thinkphp/firstproject/Public/Js/mootools.js"></script>
    <script type="text/javascript" src="/thinkphp/firstproject/Public/Js/CheckForm.js "></script>
    <script type="text/javascript" src="/thinkphp/firstproject/Public/Js/Ajax/ThinkAjax.js"></script>
    <script>
        function change(){
            var username=document.getElementsByName('username')[0];
            var userpassword=document.getElementsByName('password')[0];
            //alert(userpassword.value);
            /*var url="<?php echo U('Home/do_add','','');?>";
            $.post(/thinkphp/firstproject/index.php/Home/Index/test,{username.value,userpassword.value},
            function(data)
            {
                if(data.status){
                    var str="name"+data.username+"psw"+data.userpassword;
                    alert(str);
                }
                else{
                    alert("发布失败");
                }
            },"json");*/

            ThinkAjax.send('/thinkphp/firstproject/index.php/Home/Index/test1','ajax=1&username='+username.value,'wc','list'); 
            //ThinkAjax.sendForm('form','/thinkphp/firstproject/index.php/Home/Index/test1',wc);
        }
        function wc(data,status){
            alert("返回成功");
            if (status==1){
            $('list').innerHTML = '<span style="color:blue">'+data+'你好!</span>';
            }
        }
    </script>
</head>

<body>
    <form action="" method="POST" id="form">
        name:&nbsp;&nbsp;<input type="text" name="username"><br/>
        password:<input type="text" name="password"><br/>
        <input type="hidden" name="ajax" value="1">
        <input type="button" id="btn" onclick="change()" value="提交">
    </form>
<div id="list">
    
</div>
</body>
</html>